<?php
    namespace app\user;
    include_once('./../autoloader.php');

    use app\repository\UserRepository;
    use app\HeadComponent;
    use app\alert\AlertComponent;

    $id = (int) $_GET['id'];
    if ($id === 0) {
        echo '传入了错误的 ID 信息';
    }

    $status = UserRepository::deleteById($id);
    
    echo HeadComponent::render('删除用户');
?>
<body>
    <script type="text/javascript">
        <? 
            if ($status === true) {
                echo AlertComponent::success('index.php');
            } else {
                echo AlertComponent::error($status);
            }
        ?>
    </script>
</body>
</html>